<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        a{
            text-decoration: none;
            color: black;
        }
        .lb{
            margin: 0 auto;
            height: 378px;
            width: 600px;
            list-style: none;
            /* border: 1px solid #ff0066; */
            position: relative;
        }
        .lb .first{
            width: 80px;
            height: 40px;
            background-color: coral;
            text-align: center;
            line-height: 40px;
            border: 1px solid #ff0066;
            
        }
        .first.on{
            background-color: #ccc;
        }
        .lb-item .con{
           width: 520px;
           height: 378px;
           float: right; 
           display: none;
           text-align: center;
           font-size: 100px;
           line-height: 360px;
           /* border: 1px solid #ff0066; */
           position: absolute;
           top: 0;
           left: 80px;
           background: #ccc;
        }
        .lb-item .con.active{
            display: block;
        }
    </style>
</head>
<body>
   <ul class="lb">
        <li class="lb-item">
              <p class="first"><a href="#">分类1</a></p>
              <div class="con">内容1</div>
        </li>
        <li class="lb-item">
            <p class="first"><a href="#">分类2</a></p>
            <div class="con">内容2</div>
      </li>
      <li class="lb-item">
        <p class="first"><a href="#">分类3</a></p>
        <div class="con">内容3</div>
  </li>
  <li class="lb-item">
    <p class="first"><a href="#">分类4</a></p>
    <div class="con">内容4</div>
</li>
<li class="lb-item">
    <p class="first"><a href="#">分类6</a></p>
    <div class="con">内容6</div>
</li>
<li class="lb-item">
    <p class="first"><a href="#">分类7</a></p>
    <div class="con">内容7</div>
</li>
<li class="lb-item">
    <p class="first"><a href="#">分类8</a></p>
    <div class="con">内容8</div>
</li>
<li class="lb-item">
    <p class="first"><a href="#">分类9</a></p>
    <div class="con">内容9</div>
</li>
<li class="lb-item">
    <p class="first"><a href="#">分类10</a></p>
    <div class="con">内容10</div>
</li>
   </ul>

   <script>
       let fs =document.querySelectorAll(".first")
       let cons = document.querySelectorAll(".con")
       fs.forEach(function(f,i){
           f.addEventListener("mouseenter",function(){
               fs.forEach(function(a){
                   a.classList.remove("on")
               })
               f.classList.add("on")
               cons.forEach(function(b){
                   b.classList.remove("active")
               })
               cons[i].classList.add("active")
           })
           f.addEventListener("mouseleave",function(){
                 f.classList.remove("on")
                 cons[i].classList.remove("active")
           })
       })
   </script>
</body>
</html>